package br.com.verde.exemploteca.unapply

object DogFood {
  def unapply(f: String): Option[String] =
    if (f == "meat") Some("MEAT!") else None

  def main(args: Array[String]) {
    // Prints "Yeah MEAT!"
    "meat" match {
      case DogFood(f) => println("Yeah " + f)
      case _ => println("Bah")
    }
    // Prints "Bah"
    "fruit" match {
      case DogFood(f) => println("Yeah " + f)
      case _ => println("Bah")
    }
  }
}